<!--停气通知-->
<template>
  <div class="gas-stop-box">
    <div class="boxTitle">
      <PageTitle :text="title"></PageTitle>
    </div>
    <!-- <div class="date-tips">2023-07-04 11:26 发表于重庆</div> -->
    <div class="query" :class="{'st':true,'sticky-fixed':isF}">
      <view class="uni-form-item uni-column">
        <input class="uni-input" v-model="formData.find" confirm-type="search" @confirm="onQuery" placeholder="请输入你想查询的内容" />
        <view class="btn" @click="onQuery"><tui-icon name="search" size="20" color="#fff"></tui-icon>查询</view>
      </view>
    </div>
    <div class="con-box gasStopCon" v-if="!isData">
      <p class="p">尊敬的天然气用户：</p>
      <b class="b">近期停气具体时间及片区如下：</b>
      <div class="timeline">
        <div class="item" v-for="(item,index) in dataList" :key="index">
          <div class="time">{{item.title}}</div>
          <div class="content">
            <b class="b conTime">时间：{{item.outBeginTime}}{{item.outEndTime?'至'+item.outEndTime:''}}</b>
            <b class="b conType">原因：{{item.outReason}}</b>
            <b class="b conArea">区域：{{item.outArea}}</b>
          </div>
        </div>
      </div>
      <!-- <tui-nomore v-if="pullUpOn" backgroundColor="#fff"></tui-nomore> -->
      <b class="b">请以上区域的居民朋友做好停气准备，给大家的生活造成不便，望理解、支持。恭祝各用户朋友生活快乐，吉祥如意！</b>
      <b class="b">用户注意：使用燃气时不要离人，如果不使用时，注意关闭室内燃气管道阀门和燃具的阀门。</b>
      <div class="page-footer">
        <div>重庆中燃城市燃气发展有限公司</div>
        <!-- <div>2023年07月04</div> -->
      </div>
    </div>
    <div class="noDataBox" v-else>
      <img :src="noDataImgUrl" />
    </div>
    <FooterTel></FooterTel>
  </div>
</template>

<script>
import PageTitle from '../components/pageTitle.vue'
import FooterTel from '../components/footerTel.vue'
export default {
  name: 'Detail',
  components: {
    PageTitle,
    FooterTel
  },
  data () {
    return {
      title: null,
      icon: require('@/static/image/noticeIcon.png'),
      formData: {
        find: '',
        pageNum: 1,
        pageSize: 20
      },
      dataList: [],
      dataTotal: 0,
      noDataImgUrl: require('@/static/image/noData.png'),
      pullUpOn: false,
      isData: false,
      // 下拉固定
      yuanH: uni.upx2px(0),
      isF: false,
    };
  },
  watch: {
    'formData.find': function (newValue, oldValue) {
      if (!newValue) {
        this.onQuery()
      }
    }
  },
  async onShow () {

  },
  async onLoad (e) {
    var vm = this;
    vm.title = e.title
  },
  created () {
  },
  methods: {
    onQuery () {
      var vm = this;
      vm.formData.pageNum = 1
      vm.dataTotal = 0
      vm.dataList = []
      vm.pullUpOn = false
      vm.getList()
    },
    getList () {
      var vm = this
      vm.tui.request('/api/gasout/list', 'POST', vm.formData, false, false, false).then((res) => {
        if (res.code == 200) {
          vm.dataList = vm.dataList.concat(res.data)
          vm.dataTotal = res.total
          vm.pullUpOn = vm.formData.pageNum >= Math.ceil(vm.dataTotal / vm.formData.pageSize) ? true : false;
          vm.isData = res.total >= 1 ? false : true
        }
      }).catch((e) => { })
    },
  },
  mounted () {
    var vm = this;
    vm.getList()
  },
  onReachBottom () {
    var vm = this;
    if (vm.pullUpOn) return
    vm.formData.pageNum = vm.formData.pageNum + 1
    vm.getList();
  },
  onPageScroll (e) {
    //#ifdef H5
    this.isF = true
    // #endif
    // #ifndef H5
    if (this.yuanH > e.scrollTop) {
      this.isF = false
    } else {
      this.isF = true
    }
    // #endif
  },
};
</script>

<style lang="scss" scoped>
@import "../../static/css/module.scss";
.gas-stop-box {
  padding-bottom: 20px;
  .boxTitle {
    padding: 10px 14px 0;
  }
  .gasStopCon {
    padding: 18px 20px;
    margin: 14px;
    font-size: 15px;
    line-height: 26px;
    // 时间轴
    .timeline {
      padding-bottom: 12px;
      .item {
        padding: 10px 0 0;
        position: relative;
        &::before {
          content: "";
          position: absolute;
          left: 11px;
          top: 29px;
          bottom: 0;
          width: 0;
          height: 100%;
          border-left: 2px dashed #d9e6ff;
        }
        &:last-child::before {
          height: auto;
        }
        .time {
          height: auto;
          line-height: 22px;
          position: relative;
          font-size: 16px;
          padding: 2px 0 2px 30px;
          color: #222;
          &::after {
            content: "";
            position: absolute;
            left: 0;
            right: 0;
            top: 12px;
            width: 24px;
            height: 24px;
            margin-top: -12px;
            border-radius: 50%;
            background: #1462ff url("../../static/image/timeIcon.png");
            background-repeat: no-repeat;
            background-position: center;
            background-size: 60%;
          }
        }
        .content {
          margin-left: 30px;
          padding-bottom: 10px;
          font-size: 15px;
          border-bottom: 1px solid #eee;
          b.b {
            padding: 4px 0;
            color: #444;
          }
          .conTime,
          .conType {
            line-height: 22px;
          }
          .conArea {
            line-height: 26px;
          }
        }
      }
    }
  }
  // __________________________
  .detailContent,
  .tips {
    padding: 0 18px 20px;
    margin: 14px;
    font-size: 15px;
    line-height: 22px;
    overflow: hidden;
    .title {
      width: 100%;
      height: 30px;
      padding-left: 14px;
      line-height: 30px;
      font-size: 17px;
      font-weight: bold;
      color: #222;
      box-sizing: border-box;
      margin: 10px 0;
    }
  }

  .query {
    padding: 14px;
    .uni-form-item {
      position: relative;
      .uni-input {
        height: 40px;
        line-height: 40px;
        background: #fff;
        font-size: 15px;
        padding: 0 14px;
        border-radius: 8px;
      }
      .btn {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 80px;
        line-height: 38px;
        position: absolute;
        bottom: 1px;
        right: 0;
        background: rgb(20, 98, 255);
        font-size: 15px;
        color: #fff;
        border-radius: 0 8px 8px 0;
        .tui-icon {
          padding-right: 4px;
        }
      }
    }
  }
  .noDataBox {
    display: flex;
    align-items: center;
    justify-content: center;
    img {
      width: 70%;
      margin: 20% auto;
    }
  }
  .st {
    // height: 90rpx;
    width: auto;
    background-color: #f2f2f2;
    z-index: 999;
    /* top: 300upx; */
  }
  .sticky-fixed {
    /* #ifdef H5 */
    position: sticky;
    top: 0;
    /* #endif */
    /* #ifndef H5 */
    position: fixed;
    top: 0;
    /* #endif */
    z-index: 999;
  }
}
</style>
